package com.gitee.wsl.compose.ui.canvaspainter.components

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import com.gitee.wsl.compose.ui.canvaspainter.PainterController
import com.gitee.wsl.compose.ui.picker.Picker
import com.gitee.wsl.compose.ui.picker.color.Color


@Composable
internal fun DialogColorPicker(controller: PainterController, onDismissed: () -> Unit) {
    Dialog(onDismissRequest = {
        onDismissed()
    }, properties = DialogProperties()) {
        Picker.Color(
            modifier = Modifier
                .fillMaxWidth()
                .height(300.dp),
            initialColor = controller.selectedColor.value.color,
            onColorChanged = { color ->
                controller.setCustomColor(color)
            },
        )
//        HsvColorPicker(
//            modifier = Modifier
//                .fillMaxWidth()
//                .height(300.dp),
//            onColorChanged = {
//                controller.setCustomColor(it.color)
//            },
//            controller = rememberColorPickerController(),
//        )
    }
}